package com.barbeque.mall.util;

import lombok.Data;

/**
 * @author Tezel
 * @since 2022/07/19 19:56
 */

@Data
public class OptionStatus {

    private boolean aftersale = false;

    private boolean cancel = false;

    private boolean comment = false;

    // true 确认收获
    private boolean confirm = false;

    private boolean delete = false;

    private boolean pay = false;

    private boolean rebuy = false;

    //true 已付款显示申请退款
    private boolean refund = false;


    public static OptionStatus chooseStatus(Short orderStatus){
        if("101".equals(orderStatus.toString())){
            return OptionStatus.unPay();
        }
        if("102".equals(orderStatus.toString())){
            return OptionStatus.cancel();
        }

        if("201".equals(orderStatus.toString())){
           return OptionStatus.pay();
        }
        if("202".equals(orderStatus.toString())){
           return OptionStatus.refund();
        }
        if("203".equals(orderStatus.toString())){
           return OptionStatus.hasRefund();
        }

        if("301".equals(orderStatus.toString())){
           return OptionStatus.confirm();
        }

        return OptionStatus.complete();

    }




    /**
     * 未付款，显示取消订单
     * 状态码101
     * @author Tezel
     * @date 2022/07/19
     */

    public static OptionStatus unPay(){

        OptionStatus optionStatus = new OptionStatus();

        optionStatus.setCancel(true);
        optionStatus.setPay(true);

        return optionStatus;
    }


    /**
     * 已取消，取消订单
     * 状态码102
     * @author Tezel
     * @date 2022/07/19
     */

    public static OptionStatus cancel(){

        OptionStatus optionStatus = new OptionStatus();

       optionStatus.setDelete(true);

        return optionStatus;
    }



    /**
     * 待发货，已付款，显示申请退款
     * 状态码201
     * @author Tezel
     * @date 2022/07/19
     */

    public static OptionStatus pay(){

        OptionStatus optionStatus = new OptionStatus();

        optionStatus.setRefund(true);

        return optionStatus;
    }




    /**
     * 取消订单，退款中
     * 状态码202
     * @author Tezel
     * @date 2022/07/19
     */

    public static OptionStatus refund(){

        OptionStatus optionStatus = new OptionStatus();


        return optionStatus;
    }


    /**
     * 已退款，显示删除订单
     * 状态码203
     * @author Tezel
     * @date 2022/07/19
     */
    public static OptionStatus hasRefund(){

        OptionStatus optionStatus = new OptionStatus();

        optionStatus.setDelete(true);


        return optionStatus;
    }


    /**
     * 已发货，显示确认收货
     * 状态码301
     * @author Tezel
     * @date 2022/07/19
     */
    public static OptionStatus confirm(){

        OptionStatus optionStatus = new OptionStatus();

        optionStatus.setConfirm(true);

        return optionStatus;
    }

    /**
     * 确实收货后，显示删除订单，申请售后，再次购买，去评价
     * 状态码401
     * 402(系统收货)
     * @author Tezel
     * @date 2022/07/19
     */
    public static OptionStatus complete(){

        OptionStatus optionStatus = new OptionStatus();

        optionStatus.setAftersale(true);

        optionStatus.setComment(true);

        optionStatus.setDelete(true);

        optionStatus.setRebuy(true);

        return optionStatus;
    }



}
